package com.example.commonbiz

import okhttp3.Interceptor
import okhttp3.Response

class CustomLoggingInterceptor : Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val request = chain.request()

        // 打印请求信息
        println("Request URL: ${request.url}")
        println("Request Headers: ${request.headers}")

        val response = chain.proceed(request)

        // 打印响应信息
        println("Response Code: ${response.code}")
        println("Response Body: ${response.peekBody(1024 * 1024).string()}")

        return response
    }
}